﻿#pragma execution_character_set("utf-8")
// 本文件为utf-8 编码格式

#include "GdWebviewViewController.h"

GdWebviewViewController* GdWebviewViewController::create(std::string url, std::string title)
{
	GdWebviewViewController *viewController = new GdWebviewViewController(url);
	CANavigationBarItem *item = CANavigationBarItem::create(title);
	viewController->setNavigationBarItem(item);
	
	return viewController;
}

GdWebviewViewController::GdWebviewViewController(std::string defaultUrl)
:defaultUrl(defaultUrl)
{
}


GdWebviewViewController::~GdWebviewViewController(void)
{
}

bool GdWebviewViewController::init(){
	if (!CAViewController::init()){
		return false;
	}

	return true;
}

void GdWebviewViewController::viewDidLoad(){
	webview = CAWebView::createWithFrame(this->getView()->getBounds());
	this->getView()->addSubview(webview);

	webview->loadURL(defaultUrl);
}
void GdWebviewViewController::viewDidUnload(){

}
void GdWebviewViewController::viewDidAppear(){

}
void GdWebviewViewController::viewDidDisappear(){

}